package com.example.myapplication;

import com.google.gson.annotations.SerializedName;

import java.util.List;

/**
 * 统一设备数据模型
 * 整合所有设备信息，用于上传到服务器
 */
public class DeviceDataModel {
    
    // 设备基本信息
    @SerializedName("deviceId")
    private String deviceId; // 设备唯一标识
    
    @SerializedName("deviceModel")
    private String deviceModel; // 设备型号
    
    @SerializedName("androidVersion")
    private String androidVersion; // Android版本
    
    @SerializedName("apiLevel")
    private int apiLevel; // API级别
    
    @SerializedName("appVersion")
    private String appVersion; // 应用版本
    
    @SerializedName("appVersionCode")
    private int appVersionCode; // 应用版本号
    
    // 时间信息
    @SerializedName("timestamp")
    private long timestamp; // 数据收集时间戳
    
    @SerializedName("bootTime")
    private long bootTime; // 开机时间
    
    @SerializedName("systemUptime")
    private long systemUptime; // 系统运行时长（毫秒）
    
    @SerializedName("currentTime")
    private long currentTime; // 当前时间
    
    // 系统信息
    @SerializedName("isScreenOn")
    private boolean isScreenOn; // 屏幕状态
    
    @SerializedName("totalMemory")
    private long totalMemory; // 总内存（字节）
    
    @SerializedName("availableMemory")
    private long availableMemory; // 可用内存（字节）
    
    @SerializedName("memoryUsagePercent")
    private int memoryUsagePercent; // 内存使用百分比
    
    @SerializedName("hasRootPermission")
    private boolean hasRootPermission; // Root权限状态
    
    // 电池信息
    @SerializedName("batteryLevel")
    private Integer batteryLevel; // 电池电量（-1表示无法获取）
    
    @SerializedName("isCharging")
    private Boolean isCharging; // 是否充电（null表示无法确定）
    
    // 应用使用统计
    @SerializedName("appUsageStats")
    private List<AppUsageData> appUsageStats; // 应用使用统计列表
    
    // 电源事件
    @SerializedName("recentPowerEvents")
    private List<PowerEventData> recentPowerEvents; // 最近的电源事件
    
    // 浏览记录
    @SerializedName("recentBrowseEvents")
    private List<BrowseEventData> recentBrowseEvents; // 最近的浏览记录
    
    // 聊天消息
    @SerializedName("recentChatMessages")
    private List<ChatMessageData> recentChatMessages; // 最近的聊天消息
    
    // Getters and Setters
    public String getDeviceId() {
        return deviceId;
    }
    
    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }
    
    public String getDeviceModel() {
        return deviceModel;
    }
    
    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }
    
    public String getAndroidVersion() {
        return androidVersion;
    }
    
    public void setAndroidVersion(String androidVersion) {
        this.androidVersion = androidVersion;
    }
    
    public int getApiLevel() {
        return apiLevel;
    }
    
    public void setApiLevel(int apiLevel) {
        this.apiLevel = apiLevel;
    }
    
    public String getAppVersion() {
        return appVersion;
    }
    
    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }
    
    public int getAppVersionCode() {
        return appVersionCode;
    }
    
    public void setAppVersionCode(int appVersionCode) {
        this.appVersionCode = appVersionCode;
    }
    
    public long getTimestamp() {
        return timestamp;
    }
    
    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
    
    public long getBootTime() {
        return bootTime;
    }
    
    public void setBootTime(long bootTime) {
        this.bootTime = bootTime;
    }
    
    public long getSystemUptime() {
        return systemUptime;
    }
    
    public void setSystemUptime(long systemUptime) {
        this.systemUptime = systemUptime;
    }
    
    public long getCurrentTime() {
        return currentTime;
    }
    
    public void setCurrentTime(long currentTime) {
        this.currentTime = currentTime;
    }
    
    public boolean isScreenOn() {
        return isScreenOn;
    }
    
    public void setScreenOn(boolean screenOn) {
        isScreenOn = screenOn;
    }
    
    public long getTotalMemory() {
        return totalMemory;
    }
    
    public void setTotalMemory(long totalMemory) {
        this.totalMemory = totalMemory;
    }
    
    public long getAvailableMemory() {
        return availableMemory;
    }
    
    public void setAvailableMemory(long availableMemory) {
        this.availableMemory = availableMemory;
    }
    
    public int getMemoryUsagePercent() {
        return memoryUsagePercent;
    }
    
    public void setMemoryUsagePercent(int memoryUsagePercent) {
        this.memoryUsagePercent = memoryUsagePercent;
    }
    
    public boolean isHasRootPermission() {
        return hasRootPermission;
    }
    
    public void setHasRootPermission(boolean hasRootPermission) {
        this.hasRootPermission = hasRootPermission;
    }
    
    public Integer getBatteryLevel() {
        return batteryLevel;
    }
    
    public void setBatteryLevel(Integer batteryLevel) {
        this.batteryLevel = batteryLevel;
    }
    
    public Boolean getIsCharging() {
        return isCharging;
    }
    
    public void setIsCharging(Boolean isCharging) {
        this.isCharging = isCharging;
    }
    
    public List<AppUsageData> getAppUsageStats() {
        return appUsageStats;
    }
    
    public void setAppUsageStats(List<AppUsageData> appUsageStats) {
        this.appUsageStats = appUsageStats;
    }
    
    public List<PowerEventData> getRecentPowerEvents() {
        return recentPowerEvents;
    }
    
    public void setRecentPowerEvents(List<PowerEventData> recentPowerEvents) {
        this.recentPowerEvents = recentPowerEvents;
    }
    
    public List<BrowseEventData> getRecentBrowseEvents() {
        return recentBrowseEvents;
    }
    
    public void setRecentBrowseEvents(List<BrowseEventData> recentBrowseEvents) {
        this.recentBrowseEvents = recentBrowseEvents;
    }
    
    public List<ChatMessageData> getRecentChatMessages() {
        return recentChatMessages;
    }
    
    public void setRecentChatMessages(List<ChatMessageData> recentChatMessages) {
        this.recentChatMessages = recentChatMessages;
    }
    
    /**
     * 应用使用统计数据
     */
    public static class AppUsageData {
        @SerializedName("packageName")
        private String packageName;
        
        @SerializedName("appName")
        private String appName;
        
        @SerializedName("totalTime")
        private long totalTime; // 总使用时间（毫秒）
        
        @SerializedName("lastUsedTime")
        private long lastUsedTime; // 最后使用时间
        
        public String getPackageName() {
            return packageName;
        }
        
        public void setPackageName(String packageName) {
            this.packageName = packageName;
        }
        
        public String getAppName() {
            return appName;
        }
        
        public void setAppName(String appName) {
            this.appName = appName;
        }
        
        public long getTotalTime() {
            return totalTime;
        }
        
        public void setTotalTime(long totalTime) {
            this.totalTime = totalTime;
        }
        
        public long getLastUsedTime() {
            return lastUsedTime;
        }
        
        public void setLastUsedTime(long lastUsedTime) {
            this.lastUsedTime = lastUsedTime;
        }
    }
    
    /**
     * 电源事件数据
     */
    public static class PowerEventData {
        @SerializedName("timestamp")
        private long timestamp;
        
        @SerializedName("type")
        private String type; // "boot" 或 "shutdown"
        
        public long getTimestamp() {
            return timestamp;
        }
        
        public void setTimestamp(long timestamp) {
            this.timestamp = timestamp;
        }
        
        public String getType() {
            return type;
        }
        
        public void setType(String type) {
            this.type = type;
        }
    }
    
    /**
     * 浏览事件数据
     */
    public static class BrowseEventData {
        @SerializedName("timestamp")
        private long timestamp;
        
        @SerializedName("url")
        private String url;
        
        @SerializedName("title")
        private String title;
        
        public long getTimestamp() {
            return timestamp;
        }
        
        public void setTimestamp(long timestamp) {
            this.timestamp = timestamp;
        }
        
        public String getUrl() {
            return url;
        }
        
        public void setUrl(String url) {
            this.url = url;
        }
        
        public String getTitle() {
            return title;
        }
        
        public void setTitle(String title) {
            this.title = title;
        }
    }
    
    /**
     * 聊天消息数据
     */
    public static class ChatMessageData {
        @SerializedName("timestamp")
        private long timestamp;
        
        @SerializedName("content")
        private String content;
        
        @SerializedName("topic")
        private String topic;
        
        public long getTimestamp() {
            return timestamp;
        }
        
        public void setTimestamp(long timestamp) {
            this.timestamp = timestamp;
        }
        
        public String getContent() {
            return content;
        }
        
        public void setContent(String content) {
            this.content = content;
        }
        
        public String getTopic() {
            return topic;
        }
        
        public void setTopic(String topic) {
            this.topic = topic;
        }
    }
}

